package com.hengfoxwolf.jnidemo
import android.os.Bundle
import com.hengfoxwolf.jnidemo.databinding.ActivityFmodUseBinding
import org.fmod.FMOD

class FmodUseActivity : BaseActivity<ActivityFmodUseBinding>(ActivityFmodUseBinding::inflate) {

    //assets文件夹下文件路径
    private var path: String = "file:///android_asset/singing.wav"

    override fun init(savedInstanceState: Bundle?) {
        FMOD.init(this)
        playVoice(path, MODE_NORMAL)
    }

    override fun onDestroy() {
        super.onDestroy()
        FMOD.close()
    }

    private external fun playVoice(path: String? = null, type: Int)

    companion object {
        init {
            System.loadLibrary("fmoduselib")
        }

        val MODE_NORMAL = 0
        val MODE_LUOLI = 1
        val MODE_DASHU = 2
        val MODE_JINGSONG = 3
        val MODE_GAOGUAI = 4
        val MODE_KONGLING = 5
    }

}